<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="com.infomanage.po.*" %>
<%@page import="com.infomanage.vo.*" %>
<%@page import="com.infomanage.enums.*"%>
<%@page import="com.infomanage.service.emergency.*"%>
<%  response.addDateHeader("Expires", 0);response.setHeader("Pragma","no-cache"); response.setHeader("Cache-Control","no-cache");%>
<%
	request.setCharacterEncoding("UTF-8");
	String itemId = request.getParameter("itemId");
    if(itemId == null) itemId = "";
    
    EmergencyContactInfo item = EmergencyContactInfoService.loadEmergencyContactInfo(request, response, out);
    String homeTelephoneNo = "";
    String personName = "";
    String adress = "";
    String cellPhone = "";
    String description = "";
    String place = "";
    String position = "";
    String telephoneNo = "";
    if(item != null) {
    	homeTelephoneNo = item.getHomeTelephoneNo();
    	personName = item.getPersonName();
    	adress = item.getAdress();
    	cellPhone = item.getCellPhone();
    	description = item.getDescription();
    	place = item.getPlace();
    	position = item.getPosition();
    	telephoneNo = item.getTelephoneNo();
    } 
%>
<html>
<head>
	<title>服务矿区联系方式</title>
	<link href="../../css/table.css" rel="stylesheet" type="text/css">
	<link href="../../css/calendar.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="../../js/calendar.js"></script>
	<script type="text/javascript" src="../../js/common.js"></script>
	<script type="text/javascript">
	 function init() {
		   if("" != "<%=itemId%>") { // 修改
		   		form1.position.value = "<%=position%>";
		   }
	   }
	   // 提交
	   function doSubmit(){
	   		if(validate()){
	   			return;
	   		}
		 	if("" == "<%=itemId%>") {
		 		form1.actionType.value = "add";
			}else {
		 		form1.actionType.value = "modify";
			}
		 	form1.submit();
	   }
	   
	   function validate(){
	   		if(form1.place.value == ""){
	   			alert("服务矿区名称不能为空！");
	   			return true;
	   		}
	   		
	   		if(form1.personName.value == ""){
	   			alert("联系人不能为空！");
	   			return true;
	   		}
	   		
	   		if(form1.place.value.length > 1000){
   				alert("服务矿区名称不能超过1000个字！");
   				return true;
	   	    }
	   		
	   		if(form1.personName.value.length > 50){
   				alert("联系人不能超过50个字！");
   				return true;
	   	    }
	   		
	   		if(form1.position.value.length > 50){
   				alert("职务不能超过50个字！");
   				return true;
	   	    }
	   		
	   		if(form1.cellPhone.value.length > 1000){
   				alert("手机不能超过1000个字！");
   				return true;
	   	    }
	   		
	   		if(form1.telephoneNo.value.length > 1000){
   				alert("办公固定电话不能超过1000个字！");
   				return true;
	   	    }
	   	    
	   		if(form1.homeTelephoneNo.value.length > 1000){
   				alert("固定电话不能超过1000个字！");
   				return true;
	   	    }
	   		
	   		if(form1.adress.value.length > 1000){
   				alert("住址不能超过1000个字！");
   				return true;
	   	    }
	   		
	   		if(form1.description.value.length > 1000){
   				alert("备注不能超过1000个字！");
   				return true;
	   	    }
	   		return false;
	   }

	   function showError(error){
		   alert(error);
	   }

	   function showInfo(info){
		   alert(info);
		   window.returnValue = "ok";
		   window.close();
	   }
	</script>
</head>
<body  rightmargin="0" bottommargin="0" leftmargin="0" topmargin="0" onclick="clickBody();" onload="init();">
	<form name="form1" action="contactInfo_action.jsp" method="post" target="actionFrame">
	<input type="hidden" name="itemId" value="<%=itemId%>">
	<input type="hidden" name="actionType">
	<table class="dialogTable" cellpadding="0" cellspacing="0">
		<!-- 表头-->
		<tr class="dialogTableHeader">
			<td>服务矿区联系方式</td>
		</tr>
		<!-- 表数据-->
		<tr class="dialogTableContent">
			<td>
				<!-- 数据项 -->
				<table class="dataTable">
					<col width="30%">
					<col width="70%">
					<tr>
						<td class="field">
							服务矿区名称
						</td>
						<td>
							<input value="<%=place%>" name="place" style="width: 100%" type="text">
						</td>
					</tr>
					<tr>
						<td class="field">
							联系人
						</td>
						<td>
 							<input name="personName" value="<%=personName %>" style="width: 100%">
						</td>
					</tr>
					<tr>
						<td class="field">
							职务
						</td>
						<td>
							<input value="<%=position%>" name="position" style="width: 100%" type="text">
						</td>
					</tr>
					<tr>
						<td  class="field">
							手机
						</td>
						<td>
							<input value="<%=cellPhone %>" style="width: 100%;" name="cellPhone">
						</td>
					</tr>
					<tr>
						<td class="field">
							办公固定电话
						</td>
						<td>
							<input value="<%=telephoneNo %>" style="width: 100%;" name="telephoneNo">
						</td>
					</tr>
					<tr>
						<td class="field">
							住宅固定电话
						</td>
						<td>
							<input value="<%=homeTelephoneNo %>" style="width: 100%;" name="homeTelephoneNo">
						</td>
					</tr>
					<tr>
						<td class="field">
							家庭住址
						</td>
						<td>
							<input value="<%=adress%>" style="width: 100%;" name="adress">
						</td>
					</tr>
					<tr style="height: 100px">
						<td class="field">
							备注
						</td>
						<td valign="top">
							<textarea style="width: 100%;height: 100%" name="description"><%=description%></textarea>
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td colspan="2" class="tableBtn">
				<span onclick="doSubmit();">确定</span>
				<span onclick="window.close();">取消</span>
			</td>
		</tr>
		<tr valign="top">
			<td colspan="2">
				&nbsp;
			</td>
		</tr>
	</table>
	<iframe src="#" frameborder="0" id="treeFrame" name="frame" style="display: none;position: absolute;"></iframe>
	<iframe src="#" name="actionFrame" style="display: none;"></iframe>
</body>
</html>